home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / PSC_FileSt1924438162005.psc / PSC FileStore / frmCategories.frm < prev    next >
Text File  |  2005-08-09  |  27KB  |  839 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCategories 
  3.    Caption         =   "Add, Edit and Delete Categories"
  4.    ClientHeight    =   7005
  5.    ClientLeft      =   165
  6.    ClientTop       =   855
  7.    ClientWidth     =   11145
  8.    LinkTopic       =   "Form1"
  9.    LockControls    =   -1  'True
  10.    ScaleHeight     =   7005
  11.    ScaleMode       =   0  'User
  12.    ScaleWidth      =   11145
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton cmdMainMenu 
  15.       Caption         =   "Main menu"
  16.       BeginProperty Font 
  17.          Name            =   "MS Sans Serif"
  18.          Size            =   9.75
  19.          Charset         =   0
  20.          Weight          =   700
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   375
  26.       Left            =   9420
  27.       TabIndex        =   6
  28.       ToolTipText     =   "Returns to Main Menu."
  29.       Top             =   6225
  30.       Width           =   1500
  31.    End
  32.    Begin VB.CommandButton cmdCancel 
  33.       Caption         =   "Cancel"
  34.       BeginProperty Font 
  35.          Name            =   "MS Sans Serif"
  36.          Size            =   9.75
  37.          Charset         =   0
  38.          Weight          =   700
  39.          Underline       =   0   'False
  40.          Italic          =   0   'False
  41.          Strikethrough   =   0   'False
  42.       EndProperty
  43.       Height          =   375
  44.       Left            =   9420
  45.       TabIndex        =   1
  46.       ToolTipText     =   "Stop the current operation."
  47.       Top             =   3975
  48.       Width           =   1500
  49.    End
  50.    Begin VB.CommandButton cmdAdd 
  51.       Caption         =   "Add"
  52.       BeginProperty Font 
  53.          Name            =   "MS Sans Serif"
  54.          Size            =   9.75
  55.          Charset         =   0
  56.          Weight          =   700
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.       Height          =   375
  62.       Left            =   9420
  63.       TabIndex        =   2
  64.       ToolTipText     =   "Click to Add new record the Category table"
  65.       Top             =   4350
  66.       Width           =   1500
  67.    End
  68.    Begin VB.CommandButton cmdEdit 
  69.       Caption         =   "Edit"
  70.       BeginProperty Font 
  71.          Name            =   "MS Sans Serif"
  72.          Size            =   9.75
  73.          Charset         =   0
  74.          Weight          =   700
  75.          Underline       =   0   'False
  76.          Italic          =   0   'False
  77.          Strikethrough   =   0   'False
  78.       EndProperty
  79.       Height          =   375
  80.       Left            =   9420
  81.       TabIndex        =   3
  82.       ToolTipText     =   $"frmCategories.frx":0000
  83.       Top             =   4725
  84.       Width           =   1500
  85.    End
  86.    Begin VB.CommandButton cmdSave 
  87.       Caption         =   "Save"
  88.       BeginProperty Font 
  89.          Name            =   "MS Sans Serif"
  90.          Size            =   9.75
  91.          Charset         =   0
  92.          Weight          =   700
  93.          Underline       =   0   'False
  94.          Italic          =   0   'False
  95.          Strikethrough   =   0   'False
  96.       EndProperty
  97.       Height          =   375
  98.       Left            =   9420
  99.       TabIndex        =   4
  100.       ToolTipText     =   "Save the record to the Database."
  101.       Top             =   5100
  102.       Width           =   1500
  103.    End
  104.    Begin VB.CommandButton cmdDelete 
  105.       Caption         =   "Delete"
  106.       BeginProperty Font 
  107.          Name            =   "MS Sans Serif"
  108.          Size            =   9.75
  109.          Charset         =   0
  110.          Weight          =   700
  111.          Underline       =   0   'False
  112.          Italic          =   0   'False
  113.          Strikethrough   =   0   'False
  114.       EndProperty
  115.       Height          =   375
  116.       Left            =   9420
  117.       TabIndex        =   5
  118.       ToolTipText     =   "Deletes the selected entry.|Note: Directory and all files in the directory|will be erased and CANNOT be recover."
  119.       Top             =   5475
  120.       Width           =   1500
  121.    End
  122.    Begin VB.Frame frameCategories 
  123.       Caption         =   "Category Names"
  124.       BeginProperty Font 
  125.          Name            =   "MS Sans Serif"
  126.          Size            =   8.25
  127.          Charset         =   0
  128.          Weight          =   700
  129.          Underline       =   0   'False
  130.          Italic          =   0   'False
  131.          Strikethrough   =   0   'False
  132.       EndProperty
  133.       ForeColor       =   &H000000FF&
  134.       Height          =   2850
  135.       Left            =   225
  136.       TabIndex        =   8
  137.       Top             =   3720
  138.       Width           =   9000
  139.       Begin VB.ListBox lstCategories 
  140.          Height          =   2400
  141.          Left            =   120
  142.          Sorted          =   -1  'True
  143.          TabIndex        =   0
  144.          ToolTipText     =   "Click an entry to view the record."
  145.          Top             =   270
  146.          Width           =   8750
  147.       End
  148.    End
  149.    Begin VB.Frame frameRecResults 
  150.       Caption         =   "Current Record Results"
  151.       BeginProperty Font 
  152.          Name            =   "MS Sans Serif"
  153.          Size            =   8.25
  154.          Charset         =   0
  155.          Weight          =   700
  156.          Underline       =   0   'False
  157.          Italic          =   0   'False
  158.          Strikethrough   =   0   'False
  159.       EndProperty
  160.       ForeColor       =   &H000000FF&
  161.       Height          =   3375
  162.       Left            =   225
  163.       TabIndex        =   7
  164.       Top             =   100
  165.       Width           =   10695
  166.       Begin VB.PictureBox picCFXPBugFixfrmEditMove 
  167.          BorderStyle     =   0  'None
  168.          Height          =   3038
  169.          Left            =   100
  170.          ScaleHeight     =   3045
  171.          ScaleWidth      =   10500
  172.          TabIndex        =   9
  173.          Top             =   276
  174.          Width           =   10495
  175.          Begin VB.TextBox txtCategoryPath 
  176.             Height          =   285
  177.             Left            =   1830
  178.             Locked          =   -1  'True
  179.             TabIndex        =   15
  180.             TabStop         =   0   'False
  181.             ToolTipText     =   $"frmCategories.frx":00CB
  182.             Top             =   2200
  183.             Width           =   8500
  184.          End
  185.          Begin VB.TextBox txtCategoryName 
  186.             Height          =   285
  187.             Left            =   1830
  188.             Locked          =   -1  'True
  189.             TabIndex        =   14
  190.             TabStop         =   0   'False
  191.             ToolTipText     =   "Type the name of the Category here.|If directory dues not exist will be created."
  192.             Top             =   1300
  193.             Width           =   8500
  194.          End
  195.          Begin VB.TextBox txtCategoryNumber 
  196.             Alignment       =   1  'Right Justify
  197.             Height          =   285
  198.             Left            =   1830
  199.             Locked          =   -1  'True
  200.             TabIndex        =   13
  201.             TabStop         =   0   'False
  202.             ToolTipText     =   "The number that has been automatically assigned to this category.|Note: This is assigned automatically and CANOT be changed."
  203.             Top             =   400
  204.             Width           =   855
  205.          End
  206.          Begin VB.Label Label4 
  207.             Caption         =   "Category Path"
  208.             BeginProperty Font 
  209.                Name            =   "MS Sans Serif"
  210.                Size            =   9.75
  211.                Charset         =   0
  212.                Weight          =   400
  213.                Underline       =   0   'False
  214.                Italic          =   0   'False
  215.                Strikethrough   =   0   'False
  216.             EndProperty
  217.             ForeColor       =   &H000040C0&
  218.             Height          =   285
  219.             Left            =   140
  220.             TabIndex        =   12
  221.             Top             =   2200
  222.             Width           =   1700
  223.          End
  224.          Begin VB.Label Label2 
  225.             Caption         =   "Category Name"
  226.             BeginProperty Font 
  227.                Name            =   "MS Sans Serif"
  228.                Size            =   9.75
  229.                Charset         =   0
  230.                Weight          =   400
  231.                Underline       =   0   'False
  232.                Italic          =   0   'False
  233.                Strikethrough   =   0   'False
  234.             EndProperty
  235.             ForeColor       =   &H000040C0&
  236.             Height          =   285
  237.             Left            =   140
  238.             TabIndex        =   11
  239.             Top             =   1300
  240.             Width           =   1700
  241.          End
  242.          Begin VB.Label Label1 
  243.             Caption         =   "Category Number"
  244.             BeginProperty Font 
  245.                Name            =   "MS Sans Serif"
  246.                Size            =   9.75
  247.                Charset         =   0
  248.                Weight          =   400
  249.                Underline       =   0   'False
  250.                Italic          =   0   'False
  251.                Strikethrough   =   0   'False
  252.             EndProperty
  253.             ForeColor       =   &H000040C0&
  254.             Height          =   285
  255.             Left            =   140
  256.             TabIndex        =   10
  257.             Top             =   400
  258.             Width           =   1700
  259.          End
  260.       End
  261.    End
  262.    Begin VB.Menu mnuFileItem 
  263.       Caption         =   "File"
  264.       Begin VB.Menu mnuImportZipFilesItem 
  265.          Caption         =   "Import Zip Files"
  266.       End
  267.       Begin VB.Menu mnuBar0 
  268.          Caption         =   "-"
  269.       End
  270.       Begin VB.Menu mnuExitItem 
  271.          Caption         =   "Exit"
  272.       End
  273.    End
  274.    Begin VB.Menu mnuMaintenanceItem 
  275.       Caption         =   "Maintenance"
  276.       Begin VB.Menu mnuEditandMovingFilesItem 
  277.          Caption         =   "Edit and Moving Files"
  278.       End
  279.    End
  280.    Begin VB.Menu mnuToolsItem 
  281.       Caption         =   "Tools"
  282.       Begin VB.Menu mnuScreenPositionItem 
  283.          Caption         =   "Screen Position"
  284.          Begin VB.Menu mnuScreenDefaultPositionItem 
  285.             Caption         =   "Set Default Position"
  286.          End
  287.       End
  288.       Begin VB.Menu mnuDatabaseItem 
  289.          Caption         =   "Database"
  290.          Begin VB.Menu mnuCompactRepairDatabaseItem 
  291.             Caption         =   "Compact and repair Database"
  292.          End
  293.       End
  294.       Begin VB.Menu mnuCodeDayCategoriesItem 
  295.          Caption         =   "Code of the Day Categories"
  296.          Begin VB.Menu mnuImportCodeDayItem 
  297.             Caption         =   "Import Code of the Day"
  298.          End
  299.       End
  300.    End
  301.    Begin VB.Menu mnuHelpItem 
  302.       Caption         =   "Help"
  303.       Begin VB.Menu mnuContentsItem 
  304.          Caption         =   "Contents"
  305.       End
  306.       Begin VB.Menu mnuAboutItem 
  307.          Caption         =   "About"
  308.       End
  309.    End
  310. End
  311. Attribute VB_Name = "frmCategories"
  312. Attribute VB_GlobalNameSpace = False
  313. Attribute VB_Creatable = False
  314. Attribute VB_PredeclaredId = True
  315. Attribute VB_Exposed = False
  316. Option Explicit
  317. Private Tooltips As New Collection
  318. Private pbAdd As Boolean
  319. Private pbEdit As Boolean
  320. Private sOldCategoryName As String
  321. Private sOldCategoryPath As String
  322.  
  323. Private Sub Call_DoBoxClear()
  324.  
  325.     txtCategoryNumber.Text = vbNullString
  326.     txtCategoryName.Text = vbNullString
  327.     txtCategoryPath.Text = vbNullString
  328.  
  329. End Sub
  330.  
  331. Private Sub Call_DoBoxLock()
  332.  
  333.     txtCategoryName.Locked = True
  334.  
  335. End Sub
  336.  
  337. Private Sub Call_DoBoxUnLock()
  338.  
  339.     txtCategoryName.Locked = False
  340.  
  341. End Sub
  342.  
  343. Private Sub Call_DoCategoryList()
  344.  
  345.   Dim rsCategories As Recordset
  346.   Dim lCountRecords As Long
  347.  
  348.     lstCategories.Clear
  349.     Set rsCategories = DB1.OpenRecordset("SELECT * FROM Categories")
  350.     If rsCategories.RecordCount > 0 Then
  351.         cmdCancel.Enabled = False
  352.         cmdEdit.Enabled = False
  353.         cmdSave.Enabled = False
  354.         cmdDelete.Enabled = False
  355.         cmdAdd.Enabled = True
  356.         txtCategoryNumber.BackColor = &HFFFFFF 'White
  357.         txtCategoryPath.BackColor = &HFFFFFF 'White
  358.         txtCategoryName.BackColor = &HFFFFFF 'White
  359.         With rsCategories
  360.             .MoveFirst
  361.             .MoveLast
  362.             lCountRecords = .RecordCount
  363.             .MoveFirst
  364.             For lCountRecords = 1 To lCountRecords
  365.                 lstCategories.AddItem .Fields("CATEGORY_NAME")
  366.                 .MoveNext
  367.             Next lCountRecords
  368.             .Close
  369.         End With 'RSCATEGORIES
  370.       Else 'NOT RSCATEGORIES.RECORDCOUNT...
  371.         Call_DoEmptyDBCheck
  372.     End If
  373.     Set rsCategories = Nothing
  374.  
  375. End Sub
  376.  
  377. Private Sub Call_DoClearText()
  378.  
  379.   'Call Function to replace Single Quote with one Apostrophe and Double Quotes with two Apostrophes
  380.  
  381.     txtCategoryName.Text = Func_SrchReplace(txtCategoryName.Text)
  382.  
  383. End Sub
  384.  
  385. Private Sub Call_DoEmptyDBCheck()
  386.  
  387.     With lstCategories
  388.         .Clear
  389.         .BackColor = &H8000000F  'Grey
  390.         .AddItem vbNullString
  391.         .AddItem "No Entries Found"
  392.         .AddItem "Table is Empty! Please Click The ADD Button To Begin Entering Data."
  393.     End With 'LSTCATEGORIES
  394.     txtCategoryNumber.BackColor = &H8000000F    'Grey
  395.     txtCategoryPath.BackColor = &H8000000F    'Grey
  396.     txtCategoryName.BackColor = &H8000000F    'Grey
  397.     cmdCancel.Enabled = False
  398.     cmdEdit.Enabled = False
  399.     cmdSave.Enabled = False
  400.     cmdDelete.Enabled = False
  401.     cmdAdd.Enabled = True
  402.     Call_DoMBDatabaseEmpty
  403.  
  404. End Sub
  405.  
  406. Private Sub Call_DoGoneOut()
  407.  
  408.   'Saving to the register the size and position of form before leaving the form
  409.  
  410.     With Me
  411.         SaveSetting "PSC Soft", "PSC FileStore", "Height", .Height
  412.         SaveSetting "PSC Soft", "PSC FileStore", "Left", .Left
  413.         SaveSetting "PSC Soft", "PSC FileStore", "Top", .Top
  414.         SaveSetting "PSC Soft", "PSC FileStore", "Width", .Width
  415.     End With 'Me
  416.     Set Tooltips = Nothing
  417.     Set frmCategories = Nothing
  418.  
  419. End Sub
  420.  
  421. Private Sub Call_DoSaveAdd()
  422.  
  423.   Dim FSys As New FileSystemObject
  424.   Dim rsCategories As Recordset
  425.  
  426.     If Func_DoMBAddNewRec = vbYes Then
  427.         Call_DoClearText
  428.         If Func_DoBoxBlankCheck Then
  429.             Exit Sub '--->áBottom
  430.         End If
  431.         If Func_LengthCount Then
  432.             Exit Sub '--->áBottom
  433.         End If
  434.         Set rsCategories = DB1.OpenRecordset("SELECT * FROM Categories")
  435.         rsCategories.FindFirst "CATEGORY_NAME = '" & Trim$(txtCategoryName.Text) & "'"
  436.         If Not rsCategories.NoMatch Then
  437.             Call_MBAlreadyExists txtCategoryName.Text, "Category Name"
  438.             rsCategories.Close
  439.             Set rsCategories = Nothing
  440.             Exit Sub '--->áBottom
  441.         End If
  442.         If FSys.FolderExists(Trim$(txtCategoryPath.Text)) Then
  443.             Call_MBAlreadyExists txtCategoryPath.Text, "Category Path"
  444.             Exit Sub '--->áBottom
  445.           Else 'FSYS.FOLDEREXISTS(TRIM$(TXTCATEGORYPATH.TEXT)) = FALSE/0
  446.             FSys.CreateFolder (Trim$(txtCategoryPath.Text))
  447.         End If
  448.         With rsCategories
  449.             .AddNew
  450.             .Fields("CATEGORY_NUMBER") = .Fields("AutoNumber")
  451.             .Fields("CATEGORY_NAME") = Trim$(txtCategoryName.Text)
  452.             .Fields("CATEGORY_PATH") = Trim$(txtCategoryPath.Text)
  453.             .Update
  454.             .MoveLast
  455.             .Close
  456.         End With 'RSCATEGORIES
  457.         Set rsCategories = Nothing
  458.         Call_DoMBNewRecAdded
  459.         cmdCancel_Click
  460.     End If
  461.  
  462. End Sub
  463.  
  464. Private Sub Call_DoSaveEdit()
  465.  
  466.   Dim FSys As New FileSystemObject
  467.   Dim rsCategories As Recordset
  468.   Dim sSearch As String
  469.  
  470.     If Func_DoMBNewEditRec = vbNo Then
  471.         cmdCancel_Click
  472.       Else 'NOT FUNC_DOMBNEWEDITREC...
  473.         Call_DoClearText
  474.         If Func_DoBoxBlankCheck Then
  475.             Exit Sub '--->áBottom
  476.         End If
  477.         If Func_LengthCount Then
  478.             Exit Sub '--->áBottom
  479.         End If
  480.         Set rsCategories = DB1.OpenRecordset("SELECT * FROM Categories")
  481.         sSearch = Trim$(txtCategoryName.Text)
  482.         If UCase$(sSearch) <> UCase$(sOldCategoryName) Then
  483.             rsCategories.FindFirst "CATEGORY_NAME = '" & Trim$(txtCategoryName.Text) & "'"
  484.             If Not rsCategories.NoMatch Then
  485.                 Call_MBAlreadyExists txtCategoryName.Text, "Category Name"
  486.                 rsCategories.Close
  487.                 Set rsCategories = Nothing
  488.                 Exit Sub '--->áBottom
  489.             End If
  490.         End If
  491.         sSearch = Trim$(txtCategoryPath.Text)
  492.         If UCase$(sSearch) <> UCase$(sOldCategoryPath) Then
  493.             If FSys.FolderExists(Trim$(txtCategoryPath.Text)) Then
  494.                 Call_MBAlreadyExists txtCategoryPath.Text, "Category Path"
  495.                 Exit Sub '--->áBottom
  496.             End If
  497.         End If
  498.         If Not FSys.FolderExists(Trim$(txtCategoryPath.Text)) Then
  499.             FSys.MoveFolder sOldCategoryPath, Trim$(txtCategoryPath.Text)
  500.         End If
  501.         With rsCategories
  502.             .FindFirst "CATEGORY_NAME = '" & sOldCategoryName & "'"
  503.             If Not .NoMatch Then
  504.                 .Edit
  505.                 .Fields("CATEGORY_NAME") = Trim$(txtCategoryName.Text)
  506.                 .Fields("CATEGORY_PATH") = Trim$(txtCategoryPath.Text)
  507.                 .Update
  508.                 .Close
  509.             End If
  510.         End With 'RSCATEGORIES
  511.         Set rsCategories = Nothing
  512.         Call_DoMBNewRecAdded
  513.         cmdCancel_Click
  514.     End If
  515.  
  516. End Sub
  517.  
  518. Private Sub Call_DoToolTips()
  519.  
  520.   Dim Tooltip   As cToolTip
  521.   Dim Control   As Control
  522.   Dim CollKey   As String
  523.   Dim e         As Long
  524.  
  525.   'Code done by Ulli
  526.  
  527.     For Each Control In Controls 'cycle thru all controls
  528.         With Control
  529.             On Error Resume Next 'in case the control has no tooltiptext property
  530.                 CollKey = .ToolTipText 'try to access that property
  531.                 e = Err 'save error
  532.             On Error GoTo 0
  533.             If e = 0 Then 'the control has a tooltiptext property
  534.                 If Len(Trim$(.ToolTipText)) Then 'use that to create the custom tooltip
  535.                     CollKey = .Name
  536.                     On Error Resume Next 'in case control is not in an array of controls and therefore has no index property
  537.                         CollKey = CollKey & "(" & .Index & ")"
  538.                     On Error GoTo 0
  539.                     Set Tooltip = New cToolTip
  540.                     If Tooltip.Create(Control, Trim$(.ToolTipText), TTBalloonAlways, (TypeName(Control) = "TextBox"), TTIconInfo, CollKey) Then
  541.                         Tooltips.Add Tooltip, CollKey 'to keep a reference to the current tool tip class instance (prevent it from being destroyed)
  542.                         .ToolTipText = vbNullString 'kill tooltiptext so we don't get two tips
  543.                     End If
  544.                 End If
  545.             End If
  546.         End With 'CONTROL
  547.     Next Control
  548.  
  549. End Sub
  550.  
  551. Private Sub Call_ThisFormSize()
  552.  
  553.     With Me
  554.         glFormHeight = .Height
  555.         glFormLeft = .Left
  556.         glFormTop = .Top
  557.         glFormWidth = .Width
  558.     End With 'ME
  559.  
  560. End Sub
  561.  
  562. Private Sub cmdAdd_Click()
  563.  
  564.     pbAdd = True
  565.     lstCategories.Clear
  566.     Call_DoBoxClear
  567.     Call_DoBoxUnLock
  568.     txtCategoryName.BackColor = &HC0FFFF ' Light  Yellow
  569.     cmdCancel.Enabled = True
  570.     cmdAdd.Enabled = False
  571.     cmdEdit.Enabled = False
  572.     cmdSave.Enabled = True
  573.     cmdDelete.Enabled = False
  574.     txtCategoryNumber = vbNullString
  575.     txtCategoryPath = App.Path & "\ZipFiles\"
  576.     txtCategoryName.SetFocus
  577.  
  578. End Sub
  579.  
  580. Private Sub cmdCancel_Click()
  581.  
  582.     Call_DoBoxClear
  583.     Call_DoBoxUnLock
  584.     txtCategoryName.BackColor = &HFFFFFF 'White
  585.     cmdCancel.Enabled = False
  586.     cmdAdd.Enabled = True
  587.     cmdEdit.Enabled = False
  588.     cmdSave.Enabled = False
  589.     cmdDelete.Enabled = False
  590.     pbAdd = False
  591.     pbEdit = False
  592.     lstCategories.Enabled = True
  593.     Call_DoCategoryList
  594.  
  595. End Sub
  596.  
  597. Private Sub cmdDelete_Click()
  598.  
  599.   Dim FSys As New FileSystemObject
  600.   Dim rsFileDetails As Recordset
  601.   Dim rsCategories As Recordset
  602.   Dim lCountRecords As Long
  603.  
  604.     cmdCancel.Enabled = True
  605.     cmdAdd.Enabled = False
  606.     cmdEdit.Enabled = False
  607.     cmdSave.Enabled = False
  608.     cmdDelete.Enabled = False
  609.     txtCategoryName.BackColor = &HC0C0FF 'Light Red
  610.     txtCategoryNumber.BackColor = &HC0C0FF 'Light Red
  611.     txtCategoryPath.BackColor = &HC0C0FF 'Light Red
  612.     Set rsFileDetails = DB1.OpenRecordset("SELECT * FROM FileDetails WHERE CATEGORY_NUMBER = " & txtCategoryNumber.Text)
  613.     Set rsCategories = DB1.OpenRecordset("SELECT * FROM Categories")
  614.     If Func_DoMBPositiveDel = vbYes Then
  615.         If Func_DoMBSureDel("Directory and All files") = vbYes Then
  616.             Screen.MousePointer = vbHourglass
  617.             If FSys.FolderExists(txtCategoryPath.Text) Then
  618.                 FSys.DeleteFolder txtCategoryPath.Text
  619.             End If
  620.             If rsFileDetails.RecordCount > 0 Then
  621.                 With rsFileDetails
  622.                     .MoveFirst
  623.                     .MoveLast
  624.                     lCountRecords = .RecordCount
  625.                     .MoveFirst
  626.                     For lCountRecords = 1 To lCountRecords
  627.                         .Delete
  628.                         .MoveNext
  629.                     Next lCountRecords
  630.                     .Close
  631.                 End With 'RSFILEDETAILS
  632.             End If
  633.             If rsCategories.RecordCount > 0 Then
  634.                 With rsCategories
  635.                     .FindFirst "CATEGORY_NUMBER = " & txtCategoryNumber.Text
  636.                     If Not .NoMatch Then
  637.                         .Delete
  638.                         .Close
  639.                     End If
  640.                 End With 'RSCATEGORIES
  641.             End If
  642.             Screen.MousePointer = vbDefault
  643.             Call_DoMBBeenDel
  644.         End If
  645.     End If
  646.     Set rsFileDetails = Nothing
  647.     Set rsCategories = Nothing
  648.     cmdCancel_Click
  649.  
  650. End Sub
  651.  
  652. Private Sub cmdEdit_Click()
  653.  
  654.     pbEdit = True
  655.     lstCategories.Enabled = False
  656.     sOldCategoryName = Trim$(txtCategoryName.Text)
  657.     sOldCategoryPath = Trim$(txtCategoryPath.Text)
  658.     Call_DoBoxUnLock
  659.     txtCategoryName.BackColor = &HC0FFC0 ' Light  Green
  660.     cmdCancel.Enabled = True
  661.     cmdAdd.Enabled = False
  662.     cmdEdit.Enabled = False
  663.     cmdSave.Enabled = True
  664.     cmdDelete.Enabled = False
  665.     txtCategoryName.SetFocus
  666.  
  667. End Sub
  668.  
  669. Private Sub cmdMainMenu_Click()
  670.  
  671.     Call_ThisFormSize
  672.     frmStartMenu.Show
  673.     Unload Me
  674.  
  675. End Sub
  676.  
  677. Private Sub cmdSave_Click()
  678.  
  679.     Select Case True
  680.       Case pbAdd
  681.         Call_DoSaveAdd
  682.         pbAdd = False
  683.       Case pbEdit
  684.         Call_DoSaveEdit
  685.         pbEdit = False
  686.     End Select
  687.  
  688. End Sub
  689.  
  690. Private Sub Form_Load()
  691.  
  692.     gsLocalForm = Me.Caption
  693.     Me.Caption = gsProgName & " - " & Me.Caption & " - " & gsOwner
  694.     With Me
  695.         .Height = glFormHeight
  696.         .Left = glFormLeft
  697.         .Top = glFormTop
  698.         .Width = glFormWidth
  699.     End With 'ME
  700.     Call_DoToolTips
  701.     Call_DoCategoryList
  702.  
  703. End Sub
  704.  
  705. Private Sub Form_Unload(Cancel As Integer)
  706.  
  707.     Call_DoGoneOut
  708.  
  709. End Sub
  710.  
  711. Private Function Func_DoBoxBlankCheck() As Boolean
  712.  
  713.   'Find if the string is Null or contains only spaces
  714.  
  715.     Select Case vbNullString
  716.       Case Trim$(txtCategoryName.Text)
  717.         If Func_BoxBlank("Caterory Name") Then
  718.             Func_DoBoxBlankCheck = True
  719.         End If
  720.         txtCategoryName.SetFocus
  721.     End Select
  722.  
  723. End Function
  724.  
  725. Private Function Func_LengthCount() As Boolean
  726.  
  727.   'Counting characters to find if have more the maximum
  728.   'I set the records to the maximum (255) if you would like to change it
  729.   'do not forget to change here too.
  730.  
  731.     Select Case True
  732.       Case Func_MaxBoxLength(txtCategoryName.Text, "Caterory Name", 255)
  733.         Func_LengthCount = True
  734.         txtCategoryName.SetFocus
  735.       Case Func_MaxBoxLength(txtCategoryPath.Text, "Caterory Path", 255)
  736.         Func_LengthCount = True
  737.         txtCategoryPath.SetFocus
  738.     End Select
  739.  
  740. End Function
  741.  
  742. Private Sub lstCategories_Click()
  743.  
  744.   Dim rsCategories As Recordset
  745.  
  746.     Set rsCategories = DB1.OpenRecordset("SELECT * FROM Categories")
  747.     If rsCategories.RecordCount > 0 Then
  748.         With rsCategories
  749.             .FindFirst "CATEGORY_NAME = '" & lstCategories.Text & "' "
  750.             If Not .NoMatch Then
  751.                 txtCategoryNumber.Text = .Fields("CATEGORY_NUMBER")
  752.                 txtCategoryName.Text = .Fields("CATEGORY_NAME")
  753.                 txtCategoryPath.Text = .Fields("CATEGORY_PATH")
  754.                 .Close
  755.             End If
  756.         End With 'RSCATEGORIES
  757.         cmdEdit.Enabled = True
  758.         cmdDelete.Enabled = True
  759.         Call_DoBoxLock
  760.         lstCategories.SetFocus
  761.     End If
  762.     Set rsCategories = Nothing
  763.  
  764. End Sub
  765.  
  766. Private Sub mnuAboutItem_Click()
  767.  
  768.     frmAbout.Show vbModal
  769.  
  770. End Sub
  771.  
  772. Private Sub mnuCompactRepairDatabaseItem_Click()
  773.  
  774.     Call_ThisFormSize
  775.     frmCompactDB.Show
  776.     Unload Me
  777.  
  778. End Sub
  779.  
  780. Private Sub mnuContentsItem_Click()
  781.  
  782.     frmContents.Show vbModal
  783.  
  784. End Sub
  785.  
  786. Private Sub mnuEditandMovingFilesItem_Click()
  787.  
  788.     Call_ThisFormSize
  789.     frmEditMoveFiles.Show
  790.     Unload Me
  791.  
  792. End Sub
  793.  
  794. Private Sub mnuExitItem_Click()
  795.  
  796.     Call_DoGoneOut
  797.     End
  798.  
  799. End Sub
  800.  
  801. Private Sub mnuImportCodeDayItem_Click()
  802.  
  803.     Call_ThisFormSize
  804.     frmImportCodeDay.Show
  805.     Unload Me
  806.  
  807. End Sub
  808.  
  809. Private Sub mnuImportZipFilesItem_Click()
  810.  
  811.     Call_ThisFormSize
  812.     frmImportFiles.Show
  813.     Unload Me
  814.  
  815. End Sub
  816.  
  817. Private Sub mnuScreenDefaultPositionItem_Click()
  818.  
  819.     frmScreenDefault.Show
  820.     Unload Me
  821.  
  822. End Sub
  823.  
  824. Private Sub txtCategoryName_Change()
  825.  
  826.   Dim sDirectoryName As String
  827.   'Filtering the Category Path for directories illegal characters
  828.  
  829.     sDirectoryName = Func_SrchReplace(Trim$(txtCategoryName.Text))
  830.     sDirectoryName = Func_FilterString(sDirectoryName)
  831.     txtCategoryPath = App.Path & "\ZipFiles\" & sDirectoryName
  832.  
  833. End Sub
  834.  
  835. ':)Code Fixer V3.0.9 (04/08/2005 18:02:34) 6 + 541 = 547 Lines Thanks Ulli for inspiration and lots of code.
  836.  
  837. ':) Ulli's VB Code Formatter V2.17.9 (2005-Aug-09 21:50)  Decl: 6  Code: 517  Total: 523 Lines
  838. ':) CommentOnly: 9 (1.7%)  Commented: 36 (6.9%)  Empty: 106 (20.3%)  Max Logic Depth: 6
  839.